<style scoped>
</style>

<template>
<div>
 <el-form ref="setting" :model="setting" label-width="80px">
   <el-form-item label="分发平台">
   <el-select v-model="setting.nettype" placeholder="请选择平台">
     <el-option label="今日头条" value="toutiao"></el-option>
     <el-option label="喜马拉雅" value="ximalaya"></el-option>
   </el-select>
 </el-form-item>
   <el-form-item label="分发类型">
     <el-select v-model="setting.type" placeholder="请选择类型">
       <el-option label="文章" value="artical"></el-option>
       <el-option label="音频" value="video"></el-option>
     </el-select>
   </el-form-item>
   <el-form-item label="平台账号">
     <el-select v-model="setting.username" placeholder="请选择账号">
       <el-option label="123@qq.com" value="123@qq.com"></el-option>
       <el-option label="456@sina.com" value="456@sina.com"></el-option>
     </el-select>
   </el-form-item>
   <el-form-item label="标题">
     <el-input v-model="setting.title"></el-input>
   </el-form-item>
   <el-form-item label="内容">
     <el-input type="textarea" v-model="setting.content"></el-input>
   </el-form-item>
   <el-form-item label="立即发布">
     <el-radio-group v-model="setting.isImediate">
       <el-radio label="是"></el-radio>
       <el-radio label="否"></el-radio>
     </el-radio-group>
   </el-form-item>
   <el-form-item label="发布时间">
     <el-input v-model="setting.time"></el-input>
   </el-form-item>
   <el-form-item>
     <el-button type="primary" @click="onSubmit">提交</el-button>
     <el-button>取消</el-button>
   </el-form-item>
 </el-form>
</div>


</template>

<script>

    export default{
        props: [],
         data() {
              return {
                  setting: {
                      nettype: '222',
                      type: '222',
                      username: '33',
                      title: '44',
                      content: '555',
                      isImediate:'66',
                      publishTime: '444',
                }
              }
        },
        computed: {},
        components: {

        },
        mounted(){
            console.log('Component Ready.');

            this.fetchData();
            console.log('Component Ready.');

        },
        watch: {},
        events: {},
        methods: {
           onSubmit() {
               console.log('submit!');
              // console.log(this.setting);

               this.$api.post('users/publish', this.setting)
                   .then((response => {
                       console.log('12222');
                       console.log(response);
                       //this.items = response.data.data;
                   })).catch((error => {
                   console.error(error);
               }))
                   .finally(this.handleFormResponseComplete);


                          },
            fetchData(){

                this.$api.get('/users', {
                    params: {
//                        include: ''
                    }
                })
                    .then((response => {
                        console.log(response);
                        this.items = response.data.data;
                        //console.log(this.items);
                    }).bind(this))
                    .catch((error => {
                        console.error(error);
                    }).bind(this));

            }
        },
    }
</script>